package com.ruoyi.biz.letter.service.impl;

import java.util.List;

import com.ruoyi.biz.letter.domain.BizLeaderMailbox;
import com.ruoyi.biz.letter.util.CategoryUtil;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.biz.letter.mapper.BizProvinceLetterMapper;
import com.ruoyi.biz.letter.domain.BizProvinceLetter;
import com.ruoyi.biz.letter.service.IBizProvinceLetterService;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

/**
 * 省级信访Service业务层处理
 *
 * @author Fei.Cong
 * @date 2024-07-17
 */
@Service
public class BizProvinceLetterServiceImpl extends ServiceImpl<BizProvinceLetterMapper, BizProvinceLetter> implements IBizProvinceLetterService {

    @Autowired
    private BizProvinceLetterMapper bizProvinceLetterMapper;

    /**
     * 分页查询省级信访
     *
     * @param page
     * @param bizProvinceLetter 省级信访
     */
    @Override
    public IPage<BizProvinceLetter> pageList(BizProvinceLetter bizProvinceLetter, IPage<BizProvinceLetter> page) {
        IPage<BizProvinceLetter> resultPage = bizProvinceLetterMapper.selectPageList(page, bizProvinceLetter);
        for (BizProvinceLetter record : resultPage.getRecords()) {
            record.setFirstCategoryName(CategoryUtil.getCacheCategory(record.getPCategoryId()));
            record.setSecondCategoryName(CategoryUtil.getCacheCategory(record.getSCategoryId()));
        }
        return resultPage;
    }

    /**
     * 条件查询省级信访
     *
     * @param bizProvinceLetter 省级信访
     * @return
     */
    @Override
    public List<BizProvinceLetter> queryList(BizProvinceLetter bizProvinceLetter) {
        LambdaQueryWrapper<BizProvinceLetter> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        return bizProvinceLetterMapper.selectList(lambdaQueryWrapper);
    }

}
